package 拼多多;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class PDD1 {
    public static final List<String> ans  = new ArrayList<>();
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        traceBack(0,n,new StringBuilder());
        ans.sort((o1, o2) -> {
            if(o1.length()==o2.length()){
                return o1.compareTo(o2);
            }else{
                return o1.length()-o2.length();
            }
        });
        ans.forEach(System.out::println);
//        if(ans.isEmpty()) System.out.println("-1");
//        else{
//            System.out.println(ans.get(0));
//        }
    }
    public static void traceBack(int k,int n,StringBuilder sb){
        if(n==0){
            ans.add(sb.toString());
            return ;
        }
        for(int i=1;i<10;i++){
            if(sb.indexOf(String.valueOf(i))==-1){
                sb.append(i);
                traceBack(i,n-i,sb);
                sb.delete(sb.length()-1,sb.length());
            }
        }
    }
}
